[WIP][v6r20] Space token usage#3601
Conversation
…Usage * origin/spaceTokenUsage: (26 commits) Conflicts resolved Resolved conflicts v6r19p9 v6r19p9 notes testing on protocol using base types allow also space-separated arguments allow giving list of requests in a file using URLBase for everything but SRM2 case when an SE is at no sites added some doc added protection just style use resolveSEGroup avoid instantiating all local SEs marked getStorageElementOptions as deprecated style also considering CEs, not only SEs style docs and pylints ...
* upstream/integration: (25 commits) v6r19p10, v6r20-pre10 v6r19p10 v6r20-pre10 wrap lines better fix isinstance Added warning log message in case of exception log the delay only set delay once again logging fix logging delay execution if no active replicas found delay execution by 1 h if no active replicas found print NotBefore use defaultdict Catch exception when closing closed connection few more logging changes less logging in DM transfers limit logging fix case when no site is found for SE don't try and get SE metadata if replica is inactive ...
* upstream/integration: styled bug fix (double return) DMS: fix bad merge of ReplicateAndRegister
* upstream/integration: v6r19p11 v6r20-pre10 notes v6r19p11 notes using python modules always removing the sandboxes of deleted jobs just style just style added doc about shifterProxy 64 chars instead of 32 new option --Force to reset even non-failed requests + accept job IDs from a file new option --Maximum to limit the number of jobs selected + autopep8 autopep8 reset the NotBefore field for all requests when --Reset is used make pylint happier with data members RMS: add missing JOIN in the web summary query style fixed exception handling
…_SRM and DIP storages
|
__queryType is exists. I do not know why it is failing. |
| spaceTokenAttr = 'spacetoken.description?%s' % self.protocolParameters['SpaceToken'] | ||
| # gfal2 can take any srm url as a base. | ||
| spaceTokenEndpoint = self.getURLBase()['Value'] | ||
| print "%s %s" % (spaceTokenEndpoint, spaceTokenAttr) |
| occupancyStr = self.ctx.getxattr(spaceTokenEndpoint, spaceTokenAttr) | ||
| try: | ||
| occupancyDict = json.loads(occupancyStr) | ||
| except ValueError: |
There was a problem hiding this comment.
Can you prepend the comment below with a FIXME?
|
|
||
| except (gfal2.GError, ValueError) as e: | ||
| errStr = 'Something went wrong while checking for spacetoken occupancy.' | ||
| self.log.verbose(errStr, e.message) |
There was a problem hiding this comment.
Why a verbose message? Why not at least a warn?
| sTokenDict['Free'] = float(output.get('unusedsize', '0')) / 1e12 | ||
|
|
||
| sTokenDict['Total'] = float(occupancyDict.get('totalsize', '0')) / 1e6 | ||
| sTokenDict['Free'] = float(occupancyDict.get('unusedsize', '0')) / 1e6 |
There was a problem hiding this comment.
I don't know if we use Guaranteed anywhere...? What was it for, do you know?
| "createDirectory": "createDirectory", | ||
| "putDirectory": "putDirectory", | ||
| "getDirectory": "getDirectory", | ||
| "getOccupancy": "getOccupancy" |
|
|
||
| It loops over the different Storage Plugins to query it. | ||
|
|
||
| :returns: S_OK with dict (keys: Total, Guaranteed, Free) |
There was a problem hiding this comment.
Not the Guaranteed, it seems.
|
|
||
| log.debug("Negociating protocols between %s and %s (protocols %s)" % (sourceSE.name, self.name, protocols)) | ||
| log.debug( | ||
| "Negociating protocols between %s and %s (protocols %s)" % |
|
There's a strange failure in travis (pylint), please just merge upstream/integration. |
|
Actually integration fails: https://travis-ci.org/DIRACGrid/DIRAC/builds/330842302. I will have a look. |
|
I merge integration in this branch so that Travis should succeed. |
|
pylint in travis complains about can we add it to https://github.com/DIRACGrid/DIRAC/blob/integration/requirements.txt like we added fts3? |
|
We MAY try with https://gitlab.cern.ch/dmc/gfal2-bindings |
|
In theory it should complain everywhere, but pylint isn't always spotting everything everywhere. |
|
We could do it, but it requires quite some compilation work, so I think we just ignore it with a pylint flag. I will do it now, and rebase |
This PR is meant to replace #3572
It contains a real implementation of the getOccupancy for the StorageElement, as well as an implementation for GFAL2_SRM2.
Note that the version of gfal2 we use at the moment has bugs (see comments) that will be fixed in 2.15. For the time being, I wrote workarounds.
BEGINRELEASENOTES
*Core
NEW: utility to convert file sizes between different unit
*Resources
NEW: Added StorageElement.getOccupancy() method for DIP and GFAL2_SMR2 SE types
*RSS
CHANGE: Using StorageElement.getOccupancy()
ENDRELEASENOTES